import { Body, Controller, Get, Post } from '@nestjs/common';
import { NavigationMenu } from 'src/types/navigation_menu.interface';
import { NavigationMenuService } from 'src/services/navigation_menu/navigation_menu.service';
import { HttpResponse } from 'src/types/http_response.interface';

@Controller('navigationMenus')
export class NavigationMenuController {
  constructor(private readonly navigationMenuService: NavigationMenuService) {}
  @Get()
  async findAllActive(): Promise<HttpResponse<NavigationMenu[]>> {
    const data = await this.navigationMenuService.find({ isActive: true });
    return {
      success: true,
      message: 'All active navigationMenus retrieved successfully',
      data,
    };
  }
  @Post()
  async create(
    @Body() createNavigationMenuDtos: NavigationMenu[] | NavigationMenu,
  ): Promise<HttpResponse<NavigationMenu[] | NavigationMenu>> {
    const data = await this.navigationMenuService.create(
      createNavigationMenuDtos,
    );
    return {
      success: true,
      message: 'NavigationMenu created successfully',
      data,
    };
  }
}
